﻿using Jint;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using T.FAS.Runtime.Base.Entity;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using T.FAS.Runtime.Expression.Entity;
using T.FAS.Runtime.Expression.Service;
using System.Dynamic;
using T.FAS.Runtime.Expression.Plugin;

namespace T.FAS.Runtime.Expression.UnitTest
{
    [TestClass]
    public class WFUnit
    {
        /// <summary>
        /// 表达式
        /// </summary>
        [TestMethod]
        public void ExecuteEqual()
        {
            string expr = "{\"ElementType\":\"Group\",\"Filters\":[{\"ElementType\":\"Group\",\"Filters\":[{\"ElementType\":\"Filter\",\"Code\":\"DefaultCDO.Key\",\"Condition\":\"=\",\"Value\":\"s1\",\"ValueType\":0,\"CdoSetHelpID\":\"\",\"CdoSetHelpName\":\"\",\"NameField\":\"\",\"ValueField\":\"\",\"HelpName\":\"\",\"Name\":\"用户ID\"}]}]}";
            Dictionary<string, object> dic = new Dictionary<string, object>();
            Dictionary<string, object> DefaultCDO = new Dictionary<string, object>();
            DefaultCDO["Key"] = "s1";
            dic["DefaultCDO"] = DefaultCDO;
            ExprResult exprResult = ExprService.GetInstance.WFExecute(expr, new FASContext(), dic);
            Assert.IsTrue(Convert.ToBoolean(exprResult.Result));
            DefaultCDO["Key"] = "s4";
            dic["DefaultCDO"] = DefaultCDO;
            exprResult = ExprService.GetInstance.WFExecute(expr, new FASContext(), dic);
            Assert.IsFalse(Convert.ToBoolean(exprResult.Result));
        }
        /// <summary>
        /// 表达式
        /// </summary>
        [TestMethod]
        public void ExecuteLessThan()
        {
            string expr = "{\"ElementType\":\"Group\",\"Filters\":[{\"ElementType\":\"Group\",\"Filters\":[{\"ElementType\":\"Filter\",\"Code\":\"DefaultCDO.Key\",\"Condition\":\"<\",\"Value\":\"6\",\"ValueType\":0,\"CdoSetHelpID\":\"\",\"CdoSetHelpName\":\"\",\"NameField\":\"\",\"ValueField\":\"\",\"HelpName\":\"\",\"Name\":\"用户ID\"}]}]}";
            Dictionary<string, object> dic = new Dictionary<string, object>();
            Dictionary<string, object> DefaultCDO = new Dictionary<string, object>();
            DefaultCDO["Key"] = "5";
            dic["DefaultCDO"] = DefaultCDO;
            ExprResult exprResult = ExprService.GetInstance.WFExecute(expr, new FASContext(), dic);
            Assert.IsTrue(Convert.ToBoolean(exprResult.Result));
            DefaultCDO["Key"] = "7";
            dic["DefaultCDO"] = DefaultCDO;
            exprResult = ExprService.GetInstance.WFExecute(expr, new FASContext(), dic);
            Assert.IsFalse(Convert.ToBoolean(exprResult.Result));

            expr = "{\"ElementType\":\"Group\",\"Filters\":[{\"ElementType\":\"Group\",\"Filters\":[{\"ElementType\":\"Filter\",\"Code\":\"DefaultCDO.Key\",\"Condition\":\"<\",\"Value\":\"2021/11/25 17:32:21\",\"ValueType\":0,\"CdoSetHelpID\":\"\",\"CdoSetHelpName\":\"\",\"NameField\":\"\",\"ValueField\":\"\",\"HelpName\":\"\",\"Name\":\"用户ID\"}]}]}";
            DefaultCDO["Key"] = new DateTime(2000,1,1);
            dic["DefaultCDO"] = DefaultCDO;
            exprResult = ExprService.GetInstance.WFExecute(expr, new FASContext(), dic);
            Assert.IsFalse(Convert.ToBoolean(exprResult.Result));
            DefaultCDO["Key"] = DateTime.Now;
            dic["DefaultCDO"] = DefaultCDO;
            exprResult = ExprService.GetInstance.WFExecute(expr, new FASContext(), dic);
            Assert.IsFalse(Convert.ToBoolean(exprResult.Result));
        }
        /// <summary>
        /// 表达式
        /// </summary>
        [TestMethod]
        public void ExecuteIn()
        {
            string expr = "{\"ElementType\":\"Group\",\"Filters\":[{\"ElementType\":\"Group\",\"Filters\":[{\"ElementType\":\"Filter\",\"Code\":\"DefaultCDO.Key\",\"Condition\":\"in\",\"Value\":\"s1,s2,s3\",\"ValueType\":0,\"CdoSetHelpID\":\"\",\"CdoSetHelpName\":\"\",\"NameField\":\"\",\"ValueField\":\"\",\"HelpName\":\"\",\"Name\":\"用户ID\"}]}]}";
            Dictionary<string, object> dic = new Dictionary<string, object>();
            Dictionary<string, object> DefaultCDO = new Dictionary<string, object>();
            DefaultCDO["Key"] = "s1";
            dic["DefaultCDO"] = DefaultCDO;
            ExprResult exprResult = ExprService.GetInstance.WFExecute(expr, new FASContext(), dic);
            Assert.IsTrue(Convert.ToBoolean(exprResult.Result));
            DefaultCDO["Key"] = "s4";
            dic["DefaultCDO"] = DefaultCDO;
            exprResult = ExprService.GetInstance.WFExecute(expr, new FASContext(), dic);
            Assert.IsFalse(Convert.ToBoolean(exprResult.Result));
        }
        /// <summary>
        /// 表达式
        /// </summary>
        [TestMethod]
        public void ExecuteNotIn()
        {
            string expr = "{\"ElementType\":\"Group\",\"Filters\":[{\"ElementType\":\"Group\",\"Filters\":[{\"ElementType\":\"Filter\",\"Code\":\"DefaultCDO.Key\",\"Condition\":\"notin\",\"Value\":\"s1,s2,s3\",\"ValueType\":0,\"CdoSetHelpID\":\"\",\"CdoSetHelpName\":\"\",\"NameField\":\"\",\"ValueField\":\"\",\"HelpName\":\"\",\"Name\":\"用户ID\"}]}]}";
            Dictionary<string, object> dic = new Dictionary<string, object>();
            Dictionary<string, object> DefaultCDO = new Dictionary<string, object>();
            DefaultCDO["Key"] = "s4";
            dic["DefaultCDO"] = DefaultCDO;
            ExprResult exprResult = ExprService.GetInstance.WFExecute(expr, new FASContext(), dic);
            Assert.IsTrue(Convert.ToBoolean(exprResult.Result));
            DefaultCDO["Key"] = "s2";
            dic["DefaultCDO"] = DefaultCDO;
            exprResult = ExprService.GetInstance.WFExecute(expr, new FASContext(), dic);
            Assert.IsFalse(Convert.ToBoolean(exprResult.Result));
        }
        /// <summary>
        /// 表达式
        /// </summary>
        [TestMethod]
        public void ExecuteContains()
        {
            string expr = "{\"ElementType\":\"Group\",\"Filters\":[{\"ElementType\":\"Group\",\"Filters\":[{\"ElementType\":\"Filter\",\"Code\":\"DefaultCDO.Key\",\"Condition\":\"contains\",\"Value\":\"s1\",\"ValueType\":0,\"CdoSetHelpID\":\"\",\"CdoSetHelpName\":\"\",\"NameField\":\"\",\"ValueField\":\"\",\"HelpName\":\"\",\"Name\":\"用户ID\"}]}]}";
            Dictionary<string, object> dic = new Dictionary<string, object>();
            Dictionary<string, object> DefaultCDO = new Dictionary<string, object>();
            DefaultCDO["Key"] = "s1,s2";
            dic["DefaultCDO"] = DefaultCDO;
            ExprResult exprResult = ExprService.GetInstance.WFExecute(expr, new FASContext(), dic);
            Assert.IsTrue(Convert.ToBoolean(exprResult.Result));
            DefaultCDO["Key"] = "s3,s4";
            dic["DefaultCDO"] = DefaultCDO;
            exprResult = ExprService.GetInstance.WFExecute(expr, new FASContext(), dic);
            Assert.IsFalse(Convert.ToBoolean(exprResult.Result));
        }
        /// <summary>
        /// 表达式
        /// </summary>
        [TestMethod]
        public void ExecuteNotContains()
        {
            string expr = "{\"ElementType\":\"Group\",\"Filters\":[{\"ElementType\":\"Group\",\"Filters\":[{\"ElementType\":\"Filter\",\"Code\":\"DefaultCDO.Key\",\"Condition\":\"notcontains\",\"Value\":\"s1\",\"ValueType\":0,\"CdoSetHelpID\":\"\",\"CdoSetHelpName\":\"\",\"NameField\":\"\",\"ValueField\":\"\",\"HelpName\":\"\",\"Name\":\"用户ID\"}]}]}";
            Dictionary<string, object> dic = new Dictionary<string, object>();
            Dictionary<string, object> DefaultCDO = new Dictionary<string, object>();
            DefaultCDO["Key"] = "s3,s4";
            dic["DefaultCDO"] = DefaultCDO;
            ExprResult exprResult = ExprService.GetInstance.WFExecute(expr, new FASContext(), dic);
            Assert.IsTrue(Convert.ToBoolean(exprResult.Result));
            DefaultCDO["Key"] = "s1,s2";
            dic["DefaultCDO"] = DefaultCDO;
            exprResult = ExprService.GetInstance.WFExecute(expr, new FASContext(), dic);
            Assert.IsFalse(Convert.ToBoolean(exprResult.Result));
        }
        /// <summary>
        /// 表达式
        /// </summary>
        [TestMethod]
        public void ExecuteBetween()
        {
            string expr = "{\"ElementType\":\"Group\",\"Filters\":[{\"ElementType\":\"Group\",\"Filters\":[{\"ElementType\":\"Filter\",\"DataType\":\"DateTime\",\"Code\":\"DefaultCDO.Key\",\"Condition\":\"between\",\"Value\":[\"2023/08/10 00:00:00\",\"2023/08/12 23:59:59\"],\"ValueType\":0,\"CdoSetHelpID\":\"\",\"CdoSetHelpName\":\"\",\"NameField\":\"\",\"ValueField\":\"\",\"HelpName\":\"\",\"Name\":\"用户ID\"}]}]}";
            Dictionary<string, object> dic = new Dictionary<string, object>();
            Dictionary<string, object> DefaultCDO = new Dictionary<string, object>();
            DefaultCDO["Key"] = "2023-08-11";
            dic["DefaultCDO"] = DefaultCDO;
            ExprResult exprResult = ExprService.GetInstance.WFExecute(expr, new FASContext(), dic);
            Assert.IsTrue(Convert.ToBoolean(exprResult.Result));
            DefaultCDO["Key"] = "2023-08-13";
            dic["DefaultCDO"] = DefaultCDO;
            exprResult = ExprService.GetInstance.WFExecute(expr, new FASContext(), dic);
            Assert.IsFalse(Convert.ToBoolean(exprResult.Result));
        }
        /// <summary>
        /// 表达式
        /// </summary>
        [TestMethod]
        public void ExecuteDateTime()
        {
            string expr = "{\"ElementType\":\"Group\",\"Filters\":[{\"ElementType\":\"Filter\",\"Code\":\"DefaultCDO.ActualFinishDateTime\",\"Condition\":\"=\",\"Value\":\"2023-07-05 00:00:00\",\"DataType\":\"DateTime\",\"CdoSetHelpID\":\"\",\"CdoSetHelpName\":\"\",\"NameField\":\"\",\"ValueField\":\"\",\"HelpName\":\"\",\"Name\":\"实际完成时间\",\"Relation\":\"or\"}]}";
            string input = "{\"ProcessInstanceEx\":{\"BusinessKey\":\"5cb94dc6-e447-4efc-86a1-7f527b5816c1\",\"CreatedDate\":\"2023-07-05T14:09:50Z\",\"Creator\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"Id\":\"0adab1cf-761a-4115-b822-5a6222c54667\",\"LastModifiedDate\":\"2023-07-05T14:09:50Z\",\"LastModifier\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"Name\":\"user5提交的Bug申请关闭：Bug20230705102423\",\"Code\":\"202307051409479837982\",\"ProcessDefinitionId\":\"b91140e4-427e-4c2e-9b39-34ffac405afe\",\"ProcessDefinitionKey\":\"AF_DEP_Bug6\",\"StartActivityDefinitionId\":\"startevent1\",\"StartActivityInstanceId\":\"df94858f-37c7-4f72-b034-921ebf55fdca\",\"StartTime\":\"2023-07-05T14:09:48Z\",\"StartUserId\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"SuperActivityInstanceId\":null,\"SuperProcessInstanceId\":null,\"SuspensionState\":1,\"TenantId\":null,\"CategoryID\":null,\"IsUrgent\":false,\"F1\":null,\"F10\":null,\"F2\":null,\"F3\":null,\"F4\":null,\"F5\":null,\"F6\":null,\"F7\":null,\"F8\":null,\"F9\":null,\"FTag\":null},\"ProcessDefinationEx\":{\"ProcessMetaDataId\":\"9ab75ec7-e544-4ab0-aee8-e61e7369ad8a\",\"ByteArrayId\":\"6cb0496d-8a78-4ed9-91d8-47170dbe3018\",\"CreatedDate\":\"2023-07-05T14:00:05Z\",\"Creator\":\"63dc8b9c-cc85-473c-97af-885d8988b859\",\"Description\":null,\"Id\":\"b91140e4-427e-4c2e-9b39-34ffac405afe\",\"Key\":\"AF_DEP_Bug6\",\"LastModifiedDate\":\"2023-07-05T14:00:05Z\",\"LastModifier\":\"63dc8b9c-cc85-473c-97af-885d8988b859\",\"Name\":\"ApproveFlowBug6\",\"SuspensionState\":1,\"TargetNamespace\":\"T.FAS.WF.BPM.Manager.UnitTests\",\"TenantId\":null,\"Version\":1,\"CategoryID\":null,\"PublishState\":0,\"Type\":0,\"F1\":null,\"F10\":null,\"F2\":null,\"F3\":null,\"F4\":null,\"F5\":null,\"F6\":null,\"F7\":null,\"F8\":null,\"F9\":null,\"FTag\":null,\"EndEventCode\":null,\"TaskCreateEventCode\":null,\"IsNotify\":false,\"NotifyType\":\"DingDing\",\"NotifyMessageExpression\":\"\",\"FormUrl\":\"7d6e4253-3e56-49e4-8aed-813f622a6abc\",\"ProcessDefineType\":1,\"CDOMetaDataID\":\"c25d1873-1db0-412e-85e4-eac7966152b8\",\"CDOStateFiled\":\"State\",\"FormType\":1,\"ProcessStartStateValue\":5,\"StateMachineId\":\"b1587b5f-29aa-4350-8dfd-764d5e69ecf8\",\"AgreeEventKey\":\"pass\",\"RefuseEventKey\":\"nopass\",\"CancelEventKey\":\"Undo\",\"NotifyStartUser\":false,\"VariableConfigJson\":null},\"ActivityInstanceEx\":{\"ActivityDefinitionId\":\"CONDITIONS_901440745266\",\"ActivityDefinitionName\":\"Inclusive Gateway\",\"ActivityType\":\"bpmn.InclusiveGateway\",\"CreatedDate\":\"0001-01-01T00:00:00\",\"Creator\":null,\"Id\":\"213f5233-e53f-4866-b547-caa8fd9f5d72\",\"IncomingTransitionDefinitionId\":\"SequenceFlow1\",\"IsActive\":true,\"LastModifiedDate\":\"0001-01-01T00:00:00\",\"LastModifier\":null,\"ParentId\":\"0adab1cf-761a-4115-b822-5a6222c54667\",\"PrecursorActivityDefinitionId\":\"APPROVAL_402568333069\",\"PrecursorActivityInstanceId\":\"14222f08-9e9c-4e6b-9435-a7e24ba02c68\",\"ProcessDefinitionId\":\"b91140e4-427e-4c2e-9b39-34ffac405afe\",\"ProcessDefinitionKey\":\"AF_DEP_Bug6\",\"ProcessInstanceId\":\"0adab1cf-761a-4115-b822-5a6222c54667\",\"StartTime\":\"2023-07-05T14:09:49.7890881+08:00\",\"TenantId\":null,\"F1\":null,\"F10\":null,\"F2\":null,\"F3\":null,\"F4\":null,\"F5\":null,\"F6\":null,\"F7\":null,\"F8\":null,\"F9\":null,\"FTag\":null},\"ProcessInstanceVariables\":{\"finishDate\":\"2023-07-05 00:00:00\",\"Passed\":true,\"IsSimulation\":true,\"ApprovalComments\":\"同意\",\"feedbackby\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"TaskID\":\"9fd1b787-23d9-4519-82f3-0cc486b557a2\",\"name\":\"Bug20230705102423\",\"verify\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\"},\"DefaultCDO\":{\"DO_DEP_Function_Name\":null,\"DO_DEP_KeyApplication_Name\":null,\"DO_DEP_Module_Name\":null,\"DO_DEP_Organization_FullName\":null,\"DO_DEP_Product_Name\":null,\"DO_DEP_ProductLines_ProductName\":null,\"DO_DEP_Teams_Code\":null,\"DO_DEP_Teams_Name\":null,\"DO_DEP_UserInfo_UserName\":null,\"DO_DEP_UserInfo1_ID\":null,\"DO_DEP_WorkProject_Code\":null,\"DO_DEP_WorkProject_Name\":null,\"ID\":\"5cb94dc6-e447-4efc-86a1-7f527b5816c1\",\"SDO_DEP_BugCategory1_Code\":null,\"SDO_DEP_BugCategory1_Name\":null,\"SDO_DEP_BugState_Code\":5,\"SDO_DEP_BugState_Name\":\"提交审批\",\"SDO_DEP_Client_Code\":1,\"SDO_DEP_Client_Name\":\"WebPC\",\"SDO_DEP_DetectionMode_Code\":6,\"SDO_DEP_DetectionMode_DetectionPhaseCode\":\"3,4,6\",\"SDO_DEP_DetectionMode_Name\":\"随机审查\",\"SDO_DEP_DetectionPhase_Code\":4,\"SDO_DEP_DetectionPhase_Name\":\"集成测试阶段\",\"SDO_DEP_Envir_Code\":10,\"SDO_DEP_Envir_Name\":\"研发环境\",\"SDO_DEP_ProcessResult_Code\":null,\"SDO_DEP_ProcessResult_Name\":null,\"SDO_DEP_Severity_Code\":20,\"SDO_DEP_Severity_Name\":\"中\",\"SDO_DEP_SourceType_Code\":null,\"SDO_DEP_SourceType_Name\":null,\"Code\":\"Bug20230705102423\",\"Name\":\"测试2023070503\",\"State\":5,\"DocumentType1\":\"\",\"AssignTo\":\"user8\",\"AssignToID\":\"99532787-E132-43B4-80C9-72CAC2F48E49\",\"HopeResolvedDate\":null,\"PlanFinishDate\":null,\"Severity\":20,\"ProcessResult\":null,\"ProcessDescription\":\"\",\"InitSeverity\":\"\",\"ProjectID\":\"\",\"Project\":\"\",\"DutyDepartmentID\":\"\",\"DutyTeamID\":\"\",\"Note\":\"\",\"ProblemCategory\":null,\"SourceType\":\"\",\"SourceTypeCode\":\"\",\"SourceDocumentCode\":\"\",\"SourceDocumentID\":\"\",\"SourceDocumentName\":\"\",\"DetectionMode\":6,\"DetectionEnvir\":10,\"DetectionPhase\":4,\"Client\":1,\"ReproSteps\":\"<p>重现步骤：</p><p></p><p>预期结果：</p><p></p><p>实际结果：</p><p></p><p>图片：</p><p></p>\",\"BugReason\":\"\",\"AgainBugNum\":null,\"RepeatBugCode\":\"\",\"FeedBackByID\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"FeedBackBy\":\"user5\",\"ProcessByID\":\"\",\"ProcessBy\":\"\",\"VerifyByID\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"VerifyBy\":\"user5\",\"DelayCount\":null,\"InitPlanFinishDate\":null,\"ActualFinishDateTime\":\"2023-07-05T00:00:00\",\"EstimateHours\":null,\"PlanHours\":null,\"SpentHours\":null,\"StateChangeTime\":\"2023-07-05T10:25:04.672\",\"IsDelete\":false,\"ChangedTime\":null,\"ChangedBy\":\"\",\"ResponseTime\":null,\"ResponseBy\":\"\",\"AcceptDateTime\":null,\"AcceptBy\":\"\",\"ClosedTime\":null,\"ClosedBy\":\"\",\"Creator\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"CreatorName\":\"user5\",\"CreateTime\":\"2023-07-05T10:25:04.669\",\"LastModifier\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"LastModifierName\":\"user5\",\"LastModifyTime\":{\"Value\":\"2023-07-05T14:09:47.156\",\"Data\":\"2023-07-05 14:09:47.156\",\"Format\":null},\"FunctionID\":\"\",\"ModuleID\":\"\",\"KeyApplicationID\":\"\",\"ProductID\":\"\",\"ProductLineID\":\"\",\"TimeType\":null},\"FASContext\":{}}";
            Dictionary<string, object> dic = JsonConvert.DeserializeObject<Dictionary<string, object>>(input);
            ExprResult exprResult = ExprService.GetInstance.WFExecute(expr, new FASContext(), dic);
            Assert.IsTrue(exprResult.State == ResultState.Success);
        }
        /// <summary>
        /// 表达式
        /// </summary>
        [TestMethod]
        public void ExecuteTime()
        {
            string expr = "{\"ElementType\":\"Group\",\"Filters\":[{\"ElementType\":\"Filter\",\"Code\":\"DefaultCDO.TimeType\",\"Condition\":\"<\",\"Value\":\"14:00:00\",\"DataType\":\"Time\",\"CdoSetHelpID\":\"\",\"CdoSetHelpName\":\"\",\"NameField\":\"\",\"ValueField\":\"\",\"HelpName\":\"\",\"Name\":\"Time类型\",\"Relation\":\"or\"}]}";
            string input = "{\"ProcessInstanceEx\":{\"BusinessKey\":\"5cb94dc6-e447-4efc-86a1-7f527b5816c1\",\"CreatedDate\":\"2023-07-05T14:56:33Z\",\"Creator\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"Id\":\"1fd44a95-646f-4841-a649-e9a6df5f5d60\",\"LastModifiedDate\":\"2023-07-05T14:56:33Z\",\"LastModifier\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"Name\":\"user5提交的Bug申请关闭：Bug20230705102423\",\"Code\":\"202307051456314592749\",\"ProcessDefinitionId\":\"b91140e4-427e-4c2e-9b39-34ffac405afe\",\"ProcessDefinitionKey\":\"AF_DEP_Bug6\",\"StartActivityDefinitionId\":\"startevent1\",\"StartActivityInstanceId\":\"aaefa380-1a69-4277-9141-2d8df74e46ed\",\"StartTime\":\"2023-07-05T14:56:31Z\",\"StartUserId\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"SuperActivityInstanceId\":null,\"SuperProcessInstanceId\":null,\"SuspensionState\":1,\"TenantId\":null,\"CategoryID\":null,\"IsUrgent\":false,\"F1\":null,\"F10\":null,\"F2\":null,\"F3\":null,\"F4\":null,\"F5\":null,\"F6\":null,\"F7\":null,\"F8\":null,\"F9\":null,\"FTag\":null},\"ProcessDefinationEx\":{\"ProcessMetaDataId\":\"9ab75ec7-e544-4ab0-aee8-e61e7369ad8a\",\"ByteArrayId\":\"b204965e-33c1-42c0-80ff-9f29f1347c8e\",\"CreatedDate\":\"2023-07-05T14:55:32Z\",\"Creator\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"Description\":null,\"Id\":\"b91140e4-427e-4c2e-9b39-34ffac405afe\",\"Key\":\"AF_DEP_Bug6\",\"LastModifiedDate\":\"2023-07-05T14:55:32Z\",\"LastModifier\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"Name\":\"ApproveFlowBug6\",\"SuspensionState\":1,\"TargetNamespace\":\"T.FAS.WF.BPM.Manager.UnitTests\",\"TenantId\":null,\"Version\":1,\"CategoryID\":null,\"PublishState\":0,\"Type\":0,\"F1\":null,\"F10\":null,\"F2\":null,\"F3\":null,\"F4\":null,\"F5\":null,\"F6\":null,\"F7\":null,\"F8\":null,\"F9\":null,\"FTag\":null,\"EndEventCode\":null,\"TaskCreateEventCode\":null,\"IsNotify\":false,\"NotifyType\":\"DingDing\",\"NotifyMessageExpression\":\"\",\"FormUrl\":\"7d6e4253-3e56-49e4-8aed-813f622a6abc\",\"ProcessDefineType\":1,\"CDOMetaDataID\":\"c25d1873-1db0-412e-85e4-eac7966152b8\",\"CDOStateFiled\":\"State\",\"FormType\":1,\"ProcessStartStateValue\":5,\"StateMachineId\":\"b1587b5f-29aa-4350-8dfd-764d5e69ecf8\",\"AgreeEventKey\":\"pass\",\"RefuseEventKey\":\"nopass\",\"CancelEventKey\":\"Undo\",\"NotifyStartUser\":false,\"VariableConfigJson\":null},\"ActivityInstanceEx\":{\"ActivityDefinitionId\":\"CONDITIONS_901440745266\",\"ActivityDefinitionName\":\"Inclusive Gateway\",\"ActivityType\":\"bpmn.InclusiveGateway\",\"CreatedDate\":\"0001-01-01T00:00:00\",\"Creator\":null,\"Id\":\"dfbcf637-4770-4b67-b283-96a95d2a7979\",\"IncomingTransitionDefinitionId\":\"SequenceFlow1\",\"IsActive\":true,\"LastModifiedDate\":\"0001-01-01T00:00:00\",\"LastModifier\":null,\"ParentId\":\"1fd44a95-646f-4841-a649-e9a6df5f5d60\",\"PrecursorActivityDefinitionId\":\"APPROVAL_402568333069\",\"PrecursorActivityInstanceId\":\"f1b5c7fb-531f-4614-b055-8c0c9dcf1bd4\",\"ProcessDefinitionId\":\"b91140e4-427e-4c2e-9b39-34ffac405afe\",\"ProcessDefinitionKey\":\"AF_DEP_Bug6\",\"ProcessInstanceId\":\"1fd44a95-646f-4841-a649-e9a6df5f5d60\",\"StartTime\":\"2023-07-05T14:56:33.2683156+08:00\",\"TenantId\":null,\"F1\":null,\"F10\":null,\"F2\":null,\"F3\":null,\"F4\":null,\"F5\":null,\"F6\":null,\"F7\":null,\"F8\":null,\"F9\":null,\"FTag\":null},\"ProcessInstanceVariables\":{\"TaskID\":\"9b026583-e8ff-4b7e-8091-f5f510f4f24a\",\"ApprovalComments\":\"同意\",\"verify\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"Passed\":true,\"feedbackby\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"finishDate\":\"2023-07-05 00:00:00\",\"name\":\"Bug20230705102423\",\"IsSimulation\":true},\"DefaultCDO\":{\"DO_DEP_Function_Name\":null,\"DO_DEP_KeyApplication_Name\":null,\"DO_DEP_Module_Name\":null,\"DO_DEP_Organization_FullName\":null,\"DO_DEP_Product_Name\":null,\"DO_DEP_ProductLines_ProductName\":null,\"DO_DEP_Teams_Code\":null,\"DO_DEP_Teams_Name\":null,\"DO_DEP_UserInfo_UserName\":null,\"DO_DEP_UserInfo1_ID\":null,\"DO_DEP_WorkProject_Code\":null,\"DO_DEP_WorkProject_Name\":null,\"ID\":\"5cb94dc6-e447-4efc-86a1-7f527b5816c1\",\"SDO_DEP_BugCategory1_Code\":null,\"SDO_DEP_BugCategory1_Name\":null,\"SDO_DEP_BugState_Code\":5,\"SDO_DEP_BugState_Name\":\"提交审批\",\"SDO_DEP_Client_Code\":1,\"SDO_DEP_Client_Name\":\"WebPC\",\"SDO_DEP_DetectionMode_Code\":6,\"SDO_DEP_DetectionMode_DetectionPhaseCode\":\"3,4,6\",\"SDO_DEP_DetectionMode_Name\":\"随机审查\",\"SDO_DEP_DetectionPhase_Code\":4,\"SDO_DEP_DetectionPhase_Name\":\"集成测试阶段\",\"SDO_DEP_Envir_Code\":10,\"SDO_DEP_Envir_Name\":\"研发环境\",\"SDO_DEP_ProcessResult_Code\":null,\"SDO_DEP_ProcessResult_Name\":null,\"SDO_DEP_Severity_Code\":20,\"SDO_DEP_Severity_Name\":\"中\",\"SDO_DEP_SourceType_Code\":null,\"SDO_DEP_SourceType_Name\":null,\"Code\":\"Bug20230705102423\",\"Name\":\"测试2023070503\",\"State\":5,\"DocumentType1\":\"\",\"AssignTo\":\"user8\",\"AssignToID\":\"99532787-E132-43B4-80C9-72CAC2F48E49\",\"HopeResolvedDate\":\"2023-07-11T00:00:00\",\"PlanFinishDate\":null,\"Severity\":20,\"ProcessResult\":null,\"ProcessDescription\":\"\",\"InitSeverity\":\"\",\"ProjectID\":\"\",\"Project\":\"\",\"DutyDepartmentID\":\"\",\"DutyTeamID\":\"\",\"Note\":\"\",\"ProblemCategory\":null,\"SourceType\":\"\",\"SourceTypeCode\":\"\",\"SourceDocumentCode\":\"\",\"SourceDocumentID\":\"\",\"SourceDocumentName\":\"\",\"DetectionMode\":6,\"DetectionEnvir\":10,\"DetectionPhase\":4,\"Client\":1,\"ReproSteps\":\"<p>重现步骤：</p><p></p><p>预期结果：</p><p></p><p>实际结果：</p><p></p><p>图片：</p><p></p>\",\"BugReason\":\"\",\"AgainBugNum\":null,\"RepeatBugCode\":\"\",\"FeedBackByID\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"FeedBackBy\":\"user5\",\"ProcessByID\":\"\",\"ProcessBy\":\"\",\"VerifyByID\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"VerifyBy\":\"user5\",\"DelayCount\":null,\"InitPlanFinishDate\":null,\"ActualFinishDateTime\":\"2023-07-05T00:00:00\",\"EstimateHours\":null,\"PlanHours\":null,\"SpentHours\":null,\"StateChangeTime\":\"2023-07-05T10:25:04.672\",\"IsDelete\":false,\"ChangedTime\":null,\"ChangedBy\":\"\",\"ResponseTime\":null,\"ResponseBy\":\"\",\"AcceptDateTime\":null,\"AcceptBy\":\"\",\"ClosedTime\":null,\"ClosedBy\":\"\",\"Creator\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"CreatorName\":\"user5\",\"CreateTime\":\"2023-07-05T10:25:04.669\",\"LastModifier\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"LastModifierName\":\"user5\",\"LastModifyTime\":{\"Value\":\"2023-07-05T14:56:31.423\",\"Data\":\"2023-07-05 14:56:31.423\",\"Format\":null},\"FunctionID\":\"\",\"ModuleID\":\"\",\"KeyApplicationID\":\"\",\"ProductID\":\"\",\"ProductLineID\":\"\",\"TimeType\":\"12:55:00\"},\"FASContext\":{}}";
            Dictionary<string, object> dic = JsonConvert.DeserializeObject<Dictionary<string, object>>(input);
            ExprResult exprResult = ExprService.GetInstance.WFExecute(expr, new FASContext(), dic);
            Assert.IsTrue(exprResult.State == ResultState.Success);
        }
        /// <summary>
        /// 表达式
        /// </summary>
        [TestMethod]
        public void ExecuteTimeNull()
        {
            string expr = "{\"ElementType\":\"Group\",\"Filters\":[{\"ElementType\":\"Filter\",\"Code\":\"DefaultCDO.ActualFinishDateTime\",\"Condition\":\"=\",\"Value\":\"2023-07-07 00:00:00\",\"DataType\":\"DateTime\",\"CdoSetHelpID\":\"\",\"CdoSetHelpName\":\"\",\"NameField\":\"\",\"ValueField\":\"\",\"HelpName\":\"\",\"Name\":\"实际完成时间\",\"Relation\":\"or\"}]}";
            string input = "{\"ProcessInstanceEx\":{\"BusinessKey\":\"e6f306b0-e07e-463e-9099-04849a28b45b\",\"CreatedDate\":\"2023-07-05T15:57:28Z\",\"Creator\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"Id\":\"049706c9-1241-41aa-b8f4-0bb581be30fd\",\"LastModifiedDate\":\"2023-07-05T15:57:28Z\",\"LastModifier\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"Name\":\"user5提交的Bug申请关闭：Bug20230705092323\",\"Code\":\"202307051557263503577\",\"ProcessDefinitionId\":\"b91140e4-427e-4c2e-9b39-34ffac405afe\",\"ProcessDefinitionKey\":\"AF_DEP_Bug6\",\"StartActivityDefinitionId\":\"startevent1\",\"StartActivityInstanceId\":\"f2e1d5c3-b4d9-4ef9-a896-e83c0115f486\",\"StartTime\":\"2023-07-05T15:57:26Z\",\"StartUserId\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"SuperActivityInstanceId\":null,\"SuperProcessInstanceId\":null,\"SuspensionState\":1,\"TenantId\":null,\"CategoryID\":null,\"IsUrgent\":false,\"F1\":null,\"F10\":null,\"F2\":null,\"F3\":null,\"F4\":null,\"F5\":null,\"F6\":null,\"F7\":null,\"F8\":null,\"F9\":null,\"FTag\":null},\"ProcessDefinationEx\":{\"ProcessMetaDataId\":\"9ab75ec7-e544-4ab0-aee8-e61e7369ad8a\",\"ByteArrayId\":\"9d47eae4-0748-46ab-ac01-101a2d911cfc\",\"CreatedDate\":\"2023-07-05T15:57:10Z\",\"Creator\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"Description\":null,\"Id\":\"b91140e4-427e-4c2e-9b39-34ffac405afe\",\"Key\":\"AF_DEP_Bug6\",\"LastModifiedDate\":\"2023-07-05T15:57:10Z\",\"LastModifier\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"Name\":\"ApproveFlowBug6\",\"SuspensionState\":1,\"TargetNamespace\":\"T.FAS.WF.BPM.Manager.UnitTests\",\"TenantId\":null,\"Version\":1,\"CategoryID\":null,\"PublishState\":0,\"Type\":0,\"F1\":null,\"F10\":null,\"F2\":null,\"F3\":null,\"F4\":null,\"F5\":null,\"F6\":null,\"F7\":null,\"F8\":null,\"F9\":null,\"FTag\":null,\"EndEventCode\":null,\"TaskCreateEventCode\":null,\"IsNotify\":false,\"NotifyType\":\"DingDing\",\"NotifyMessageExpression\":\"\",\"FormUrl\":\"7d6e4253-3e56-49e4-8aed-813f622a6abc\",\"ProcessDefineType\":1,\"CDOMetaDataID\":\"c25d1873-1db0-412e-85e4-eac7966152b8\",\"CDOStateFiled\":\"State\",\"FormType\":1,\"ProcessStartStateValue\":5,\"StateMachineId\":\"b1587b5f-29aa-4350-8dfd-764d5e69ecf8\",\"AgreeEventKey\":\"pass\",\"RefuseEventKey\":\"nopass\",\"CancelEventKey\":\"Undo\",\"NotifyStartUser\":false,\"VariableConfigJson\":null},\"ActivityInstanceEx\":{\"ActivityDefinitionId\":\"CONDITIONS_901440745266\",\"ActivityDefinitionName\":\"Inclusive Gateway\",\"ActivityType\":\"bpmn.InclusiveGateway\",\"CreatedDate\":\"0001-01-01T00:00:00\",\"Creator\":null,\"Id\":\"9ace7046-0307-4249-bd0c-721136050fc2\",\"IncomingTransitionDefinitionId\":\"SequenceFlow1\",\"IsActive\":true,\"LastModifiedDate\":\"0001-01-01T00:00:00\",\"LastModifier\":null,\"ParentId\":\"049706c9-1241-41aa-b8f4-0bb581be30fd\",\"PrecursorActivityDefinitionId\":\"APPROVAL_402568333069\",\"PrecursorActivityInstanceId\":\"dbc0a18c-6594-4588-9acd-c48d10646144\",\"ProcessDefinitionId\":\"b91140e4-427e-4c2e-9b39-34ffac405afe\",\"ProcessDefinitionKey\":\"AF_DEP_Bug6\",\"ProcessInstanceId\":\"049706c9-1241-41aa-b8f4-0bb581be30fd\",\"StartTime\":\"2023-07-05T15:57:27.7931855+08:00\",\"TenantId\":null,\"F1\":null,\"F10\":null,\"F2\":null,\"F3\":null,\"F4\":null,\"F5\":null,\"F6\":null,\"F7\":null,\"F8\":null,\"F9\":null,\"FTag\":null},\"ProcessInstanceVariables\":{\"Passed\":true,\"finishDate\":null,\"verify\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"TaskID\":\"851a9518-fbc7-49e5-97df-afde1a821b56\",\"feedbackby\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"ApprovalComments\":\"同意\",\"name\":\"Bug20230705092323\",\"IsSimulation\":true},\"DefaultCDO\":{\"DO_DEP_Function_Name\":null,\"DO_DEP_KeyApplication_Name\":null,\"DO_DEP_Module_Name\":null,\"DO_DEP_Organization_FullName\":null,\"DO_DEP_Product_Name\":null,\"DO_DEP_ProductLines_ProductName\":null,\"DO_DEP_Teams_Code\":null,\"DO_DEP_Teams_Name\":null,\"DO_DEP_UserInfo_UserName\":null,\"DO_DEP_UserInfo1_ID\":null,\"DO_DEP_WorkProject_Code\":null,\"DO_DEP_WorkProject_Name\":null,\"ID\":\"e6f306b0-e07e-463e-9099-04849a28b45b\",\"SDO_DEP_BugCategory1_Code\":null,\"SDO_DEP_BugCategory1_Name\":null,\"SDO_DEP_BugState_Code\":5,\"SDO_DEP_BugState_Name\":\"提交审批\",\"SDO_DEP_Client_Code\":1,\"SDO_DEP_Client_Name\":\"WebPC\",\"SDO_DEP_DetectionMode_Code\":6,\"SDO_DEP_DetectionMode_DetectionPhaseCode\":\"3,4,6\",\"SDO_DEP_DetectionMode_Name\":\"随机审查\",\"SDO_DEP_DetectionPhase_Code\":4,\"SDO_DEP_DetectionPhase_Name\":\"集成测试阶段\",\"SDO_DEP_Envir_Code\":10,\"SDO_DEP_Envir_Name\":\"研发环境\",\"SDO_DEP_ProcessResult_Code\":null,\"SDO_DEP_ProcessResult_Name\":null,\"SDO_DEP_Severity_Code\":20,\"SDO_DEP_Severity_Name\":\"中\",\"SDO_DEP_SourceType_Code\":null,\"SDO_DEP_SourceType_Name\":null,\"Code\":\"Bug20230705092323\",\"Name\":\"测试2023070501\",\"State\":5,\"DocumentType1\":\"\",\"AssignTo\":\"user8\",\"AssignToID\":\"99532787-E132-43B4-80C9-72CAC2F48E49\",\"HopeResolvedDate\":null,\"PlanFinishDate\":null,\"Severity\":20,\"ProcessResult\":null,\"ProcessDescription\":\"\",\"InitSeverity\":\"\",\"ProjectID\":\"\",\"Project\":\"\",\"DutyDepartmentID\":\"\",\"DutyTeamID\":\"\",\"Note\":\"\",\"ProblemCategory\":null,\"SourceType\":\"\",\"SourceTypeCode\":\"\",\"SourceDocumentCode\":\"\",\"SourceDocumentID\":\"\",\"SourceDocumentName\":\"\",\"DetectionMode\":6,\"DetectionEnvir\":10,\"DetectionPhase\":4,\"Client\":1,\"ReproSteps\":\"<p>重现步骤：</p><p></p><p>预期结果：</p><p></p><p>实际结果：</p><p></p><p>图片：</p><p></p>\",\"BugReason\":\"\",\"AgainBugNum\":null,\"RepeatBugCode\":\"\",\"FeedBackByID\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"FeedBackBy\":\"user5\",\"ProcessByID\":\"\",\"ProcessBy\":\"\",\"VerifyByID\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"VerifyBy\":\"user5\",\"DelayCount\":null,\"InitPlanFinishDate\":null,\"ActualFinishDateTime\":null,\"EstimateHours\":null,\"PlanHours\":null,\"SpentHours\":null,\"StateChangeTime\":\"2023-07-05T09:23:45.496\",\"IsDelete\":false,\"ChangedTime\":null,\"ChangedBy\":\"\",\"ResponseTime\":null,\"ResponseBy\":\"\",\"AcceptDateTime\":null,\"AcceptBy\":\"\",\"ClosedTime\":null,\"ClosedBy\":\"\",\"Creator\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"CreatorName\":\"user5\",\"CreateTime\":\"2023-07-05T09:23:45.494\",\"LastModifier\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"LastModifierName\":\"user5\",\"LastModifyTime\":{\"Value\":\"2023-07-05T15:57:26.319\",\"Data\":\"2023-07-05 15:57:26.319\",\"Format\":null},\"FunctionID\":\"\",\"ModuleID\":\"\",\"KeyApplicationID\":\"\",\"ProductID\":\"\",\"ProductLineID\":\"\",\"TimeType\":null},\"FASContext\":{}}";
            Dictionary<string, object> dic = JsonConvert.DeserializeObject<Dictionary<string, object>>(input);
            ExprResult exprResult = ExprService.GetInstance.WFExecute(expr, new FASContext(), dic);
            Assert.IsTrue(exprResult.State == ResultState.Success);
        }
        /// <summary>
        /// 表达式
        /// </summary>
        [TestMethod]
        public void ExecuteDateNull()
        {
            string expr = "{\"ElementType\":\"Group\",\"Filters\":[{\"ElementType\":\"Filter\",\"Code\":\"DefaultCDO.HopeResolvedDate\",\"Condition\":\"=\",\"Value\":\"2023-07-08\",\"DataType\":\"Date\",\"CdoSetHelpID\":\"\",\"CdoSetHelpName\":\"\",\"NameField\":\"\",\"ValueField\":\"\",\"HelpName\":\"\",\"Name\":\"期望解决日期\",\"Relation\":\"or\"}]}";
            string input = "{\"ProcessInstanceEx\":{\"BusinessKey\":\"e6f306b0-e07e-463e-9099-04849a28b45b\",\"CreatedDate\":\"2023-07-05T16:21:36Z\",\"Creator\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"Id\":\"91efbca7-3652-412a-89f8-94650369c1d7\",\"LastModifiedDate\":\"2023-07-05T16:21:36Z\",\"LastModifier\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"Name\":\"user5提交的Bug申请关闭：Bug20230705092323\",\"Code\":\"202307051621352790441\",\"ProcessDefinitionId\":\"b91140e4-427e-4c2e-9b39-34ffac405afe\",\"ProcessDefinitionKey\":\"AF_DEP_Bug6\",\"StartActivityDefinitionId\":\"startevent1\",\"StartActivityInstanceId\":\"0cae29f6-3c5f-4f3f-bf1f-5b5e42accc8f\",\"StartTime\":\"2023-07-05T16:21:35Z\",\"StartUserId\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"SuperActivityInstanceId\":null,\"SuperProcessInstanceId\":null,\"SuspensionState\":1,\"TenantId\":null,\"CategoryID\":null,\"IsUrgent\":false,\"F1\":null,\"F10\":null,\"F2\":null,\"F3\":null,\"F4\":null,\"F5\":null,\"F6\":null,\"F7\":null,\"F8\":null,\"F9\":null,\"FTag\":null},\"ProcessDefinationEx\":{\"ProcessMetaDataId\":\"9ab75ec7-e544-4ab0-aee8-e61e7369ad8a\",\"ByteArrayId\":\"d5cf0ff6-36b1-4427-ad51-79f17a297123\",\"CreatedDate\":\"2023-07-05T16:20:58Z\",\"Creator\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"Description\":null,\"Id\":\"b91140e4-427e-4c2e-9b39-34ffac405afe\",\"Key\":\"AF_DEP_Bug6\",\"LastModifiedDate\":\"2023-07-05T16:20:58Z\",\"LastModifier\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"Name\":\"ApproveFlowBug6\",\"SuspensionState\":1,\"TargetNamespace\":\"T.FAS.WF.BPM.Manager.UnitTests\",\"TenantId\":null,\"Version\":1,\"CategoryID\":null,\"PublishState\":0,\"Type\":0,\"F1\":null,\"F10\":null,\"F2\":null,\"F3\":null,\"F4\":null,\"F5\":null,\"F6\":null,\"F7\":null,\"F8\":null,\"F9\":null,\"FTag\":null,\"EndEventCode\":null,\"TaskCreateEventCode\":null,\"IsNotify\":false,\"NotifyType\":\"DingDing\",\"NotifyMessageExpression\":\"\",\"FormUrl\":\"7d6e4253-3e56-49e4-8aed-813f622a6abc\",\"ProcessDefineType\":1,\"CDOMetaDataID\":\"c25d1873-1db0-412e-85e4-eac7966152b8\",\"CDOStateFiled\":\"State\",\"FormType\":1,\"ProcessStartStateValue\":5,\"StateMachineId\":\"b1587b5f-29aa-4350-8dfd-764d5e69ecf8\",\"AgreeEventKey\":\"pass\",\"RefuseEventKey\":\"nopass\",\"CancelEventKey\":\"Undo\",\"NotifyStartUser\":false,\"VariableConfigJson\":null},\"ActivityInstanceEx\":{\"ActivityDefinitionId\":\"CONDITIONS_901440745266\",\"ActivityDefinitionName\":\"Inclusive Gateway\",\"ActivityType\":\"bpmn.InclusiveGateway\",\"CreatedDate\":\"0001-01-01T00:00:00\",\"Creator\":null,\"Id\":\"47578cc2-9da8-461d-b429-8d43fe45d402\",\"IncomingTransitionDefinitionId\":\"SequenceFlow1\",\"IsActive\":true,\"LastModifiedDate\":\"0001-01-01T00:00:00\",\"LastModifier\":null,\"ParentId\":\"91efbca7-3652-412a-89f8-94650369c1d7\",\"PrecursorActivityDefinitionId\":\"APPROVAL_402568333069\",\"PrecursorActivityInstanceId\":\"38dbda9f-c88f-4a96-be16-dc3c2b72d6b6\",\"ProcessDefinitionId\":\"b91140e4-427e-4c2e-9b39-34ffac405afe\",\"ProcessDefinitionKey\":\"AF_DEP_Bug6\",\"ProcessInstanceId\":\"91efbca7-3652-412a-89f8-94650369c1d7\",\"StartTime\":\"2023-07-05T16:21:35.8499388+08:00\",\"TenantId\":null,\"F1\":null,\"F10\":null,\"F2\":null,\"F3\":null,\"F4\":null,\"F5\":null,\"F6\":null,\"F7\":null,\"F8\":null,\"F9\":null,\"FTag\":null},\"ProcessInstanceVariables\":{\"TaskID\":\"1f3452f5-b9cf-4d42-8670-8aecb80faac9\",\"name\":\"Bug20230705092323\",\"Passed\":true,\"verify\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"feedbackby\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"IsSimulation\":true,\"finishDate\":null,\"ApprovalComments\":\"同意\"},\"DefaultCDO\":{\"DO_DEP_Function_Name\":null,\"DO_DEP_KeyApplication_Name\":null,\"DO_DEP_Module_Name\":null,\"DO_DEP_Organization_FullName\":null,\"DO_DEP_Product_Name\":null,\"DO_DEP_ProductLines_ProductName\":null,\"DO_DEP_Teams_Code\":null,\"DO_DEP_Teams_Name\":null,\"DO_DEP_UserInfo_UserName\":null,\"DO_DEP_UserInfo1_ID\":null,\"DO_DEP_WorkProject_Code\":null,\"DO_DEP_WorkProject_Name\":null,\"ID\":\"e6f306b0-e07e-463e-9099-04849a28b45b\",\"SDO_DEP_BugCategory1_Code\":null,\"SDO_DEP_BugCategory1_Name\":null,\"SDO_DEP_BugState_Code\":5,\"SDO_DEP_BugState_Name\":\"提交审批\",\"SDO_DEP_Client_Code\":1,\"SDO_DEP_Client_Name\":\"WebPC\",\"SDO_DEP_DetectionMode_Code\":6,\"SDO_DEP_DetectionMode_DetectionPhaseCode\":\"3,4,6\",\"SDO_DEP_DetectionMode_Name\":\"随机审查\",\"SDO_DEP_DetectionPhase_Code\":4,\"SDO_DEP_DetectionPhase_Name\":\"集成测试阶段\",\"SDO_DEP_Envir_Code\":10,\"SDO_DEP_Envir_Name\":\"研发环境\",\"SDO_DEP_ProcessResult_Code\":null,\"SDO_DEP_ProcessResult_Name\":null,\"SDO_DEP_Severity_Code\":20,\"SDO_DEP_Severity_Name\":\"中\",\"SDO_DEP_SourceType_Code\":null,\"SDO_DEP_SourceType_Name\":null,\"Code\":\"Bug20230705092323\",\"Name\":\"测试2023070501\",\"State\":5,\"DocumentType1\":\"\",\"AssignTo\":\"user8\",\"AssignToID\":\"99532787-E132-43B4-80C9-72CAC2F48E49\",\"HopeResolvedDate\":null,\"PlanFinishDate\":null,\"Severity\":20,\"ProcessResult\":null,\"ProcessDescription\":\"\",\"InitSeverity\":\"\",\"ProjectID\":\"\",\"Project\":\"\",\"DutyDepartmentID\":\"\",\"DutyTeamID\":\"\",\"Note\":\"\",\"ProblemCategory\":null,\"SourceType\":\"\",\"SourceTypeCode\":\"\",\"SourceDocumentCode\":\"\",\"SourceDocumentID\":\"\",\"SourceDocumentName\":\"\",\"DetectionMode\":6,\"DetectionEnvir\":10,\"DetectionPhase\":4,\"Client\":1,\"ReproSteps\":\"<p>重现步骤：</p><p></p><p>预期结果：</p><p></p><p>实际结果：</p><p></p><p>图片：</p><p></p>\",\"BugReason\":\"\",\"AgainBugNum\":null,\"RepeatBugCode\":\"\",\"FeedBackByID\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"FeedBackBy\":\"user5\",\"ProcessByID\":\"\",\"ProcessBy\":\"\",\"VerifyByID\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"VerifyBy\":\"user5\",\"DelayCount\":null,\"InitPlanFinishDate\":null,\"ActualFinishDateTime\":null,\"EstimateHours\":null,\"PlanHours\":null,\"SpentHours\":null,\"StateChangeTime\":\"2023-07-05T09:23:45.496\",\"IsDelete\":false,\"ChangedTime\":null,\"ChangedBy\":\"\",\"ResponseTime\":null,\"ResponseBy\":\"\",\"AcceptDateTime\":null,\"AcceptBy\":\"\",\"ClosedTime\":null,\"ClosedBy\":\"\",\"Creator\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"CreatorName\":\"user5\",\"CreateTime\":\"2023-07-05T09:23:45.494\",\"LastModifier\":\"5b97d738-afbb-461d-8a77-0ddec66341ff\",\"LastModifierName\":\"user5\",\"LastModifyTime\":{\"Value\":\"2023-07-05T16:21:35.247\",\"Data\":\"2023-07-05 16:21:35.247\",\"Format\":null},\"FunctionID\":\"\",\"ModuleID\":\"\",\"KeyApplicationID\":\"\",\"ProductID\":\"\",\"ProductLineID\":\"\",\"TimeType\":null},\"FASContext\":{}}";
            Dictionary<string, object> dic = JsonConvert.DeserializeObject<Dictionary<string, object>>(input);
            ExprResult exprResult = ExprService.GetInstance.WFExecute(expr, new FASContext(), dic);
            Assert.IsTrue(exprResult.State == ResultState.Success);
        }
    }
}
